package com.dailyblue.java.project.smbms.role.controller;

import com.dailyblue.java.commons.util.JsonResult;
import com.dailyblue.java.commons.util.ResultTool;
import com.dailyblue.java.project.smbms.role.service.RoleService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/role")
public class RoleController {
    @Resource
    private RoleService roleService;

    @GetMapping("/{id}")
    public JsonResult find(@PathVariable("id") int id) {
        return ResultTool.success(roleService.getById(id));
    }

    @GetMapping
    @CrossOrigin
    public JsonResult find() {
        return ResultTool.success(roleService.list());
    }
}
